<?php
include_once('./app/MySQL.class.php');
$client_ip = $_SERVER['REMOTE_ADDR'];

$SQL = new MySQL();
$SQL->ExecuteSQL("SELECT steamid, player_name FROM player_track WHERE ip_address = '$client_ip'");

$player_track_array = $SQL->ArrayResults();

//print_r($player_track_array);

$steamid = strtolower(htmlspecialchars($_GET['steamid'])); 

?>

<div class="TexturedText"><img class="Center" src="./app/text.php?text=Make%20A%20Donation" alt="Make A Donation" /></div>
<div id="PayPalFormContainer" class="ClearFloats GradiantBackGround NeedSpace"></div> 
<div class="NeedSpace LeftContent">
    <div class="SelectOption">
        <label id="PlayerSelectLabel" for="PlayerSelect">Please select your name:</label>
        <select id="PlayerSelect" "name="PlayerSelect" onchange="optionSelect();">
            <option id="disableMe" value=""></option>
                
                <?php
                    if (count($player_track_array) >= 1) {
                        echo "<optgroup label=\"Possible Players\">";
                    
                        foreach ($player_track_array as $player) {
                            echo "<option value=\"$player[steamid]\">$player[player_name]</option>";
                        }
                        
                        echo "</optgroup>";
                    }
                ?>    
                <option value="" disabled></option>
                <optgroup label="Anonymous Donation">
                    <option value="anonymous">Anonymous</option>
                </optgroup>                
                <option value="" disabled></option>
                <optgroup label="Unlisted Player">               
                    <option value="not_listed">Steam ID Search</option>
                </optgroup>
        </select>   
        <label id="steamidLabel" for="steamid">Steam ID:</label>
        <input class="GreyBackGround" id="steamid" name="steamid" value="" readonly="readonly" />
    </div>
</div>
    
<div id="welcomeMessage"><p>Please make a selection.</p></div>

<div id="playerProfileDiv">
    <h2>Selected Profile:</h2>
    <div class="steamprofile"></div>
</div>

<div id="Search"></div>

<div id="SearchOutput">
    <fieldset>
        <legend>Results</legend>
        <p>Please click on your profile avatar.</p>
        <div id="searchProfile"><p>Please use the Search button to display results.</p></div>
        <a href="javascript:searchDeep();" id="searchDeep">Click here for more search listings.</a>
    </fieldset>
</div>

<div id="anonymousMessage"><p>Your donation will be marked as anonymous, and your name will not appear on the donor list.  Nor will you be eligable for any in game benefits that are normally provided to donors.<br /><br />Are you sure you want to do this?</p></div>

<div id="ContinuePayPal" class="ClearFloats">
    <input id="ContinueButton" class="button" type="button" onclick="continuePayPal()" value="Continue" />
</div> 

